1 /* 2 * Copyright (c) 2013 - Andre Roth <neolynx@gmail.com> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation version 2.1 of the License. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU Lesser General Public License for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this program; if not, write to the Free Software 15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 17 * 18 */ 19 20 /** 21 * @file cat.h 22 * @ingroup dvb_table 23 * @brief Provides the table parser for the CAT (Conditional Access Table) 24 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1) 25 * @author Andre Roth 26 * 27 * @par Bug Report 28 * Please submit bug reports and patches to linux-media@vger.kernel.org 29 */ 30 31 module libdvbv5_d.cat; 32 33 import core.sys.posix.unistd; 34 35 import libdvbv5_d.descriptors: dvb_desc; 36 import libdvbv5_d.dvb_fe: dvb_v5_fe_parms; 37 import libdvbv5_d.header: dvb_table_header; 38 39 extern (C): 40 41 /* ssize_t */ 42 43 /** 44 * @def DVB_TABLE_CAT 45 * @brief ATSC CAT table ID 46 * @ingroup dvb_table 47 * @def DVB_TABLE_CAT_PID 48 * @brief ATSC PID table ID 49 * @ingroup dvb_table 50 */ 51 enum DVB_TABLE_CAT = 0x01; 52 enum DVB_TABLE_CAT_PID = 0x0001; 53 54 /** 55 * @struct dvb_table_cat 56 * @brief ATSC CAT table 57 * 58 * @param header struct dvb_table_header content 59 * @param descriptor pointer to struct dvb_desc 60 */ 61 struct dvb_table_cat 62 { 63 align (1): 64 65 dvb_table_header header; 66 // struct dvb_desc; 67 dvb_desc* descriptor; 68 } 69 70 // struct dvb_v5_fe_parms; 71 72 /** 73 * @brief Initializes and parses CAT table 74 * 75 * @param parms struct dvb_v5_fe_parms pointer to the opened device 76 * @param buf buffer containing the CAT raw data 77 * @param buflen length of the buffer 78 * @param table pointer to struct dvb_table_cat to be allocated and filled 79 * 80 * This function allocates an CAT table and fills the fields inside 81 * the struct. It also makes sure that all fields will follow the CPU 82 * endianness. Due to that, the content of the buffer may change. 83 * 84 * @return On success, it returns the size of the allocated struct. 85 * A negative value indicates an error. 86 */ 87 ssize_t dvb_table_cat_init ( 88 dvb_v5_fe_parms* parms, 89 const(ubyte)* buf, 90 ssize_t buflen, 91 dvb_table_cat** table); 92 93 /** 94 * @brief Frees all data allocated by the CAT table parser 95 * 96 * @param table pointer to struct dvb_table_cat to be freed 97 */ 98 void dvb_table_cat_free (dvb_table_cat* table); 99 100 /** 101 * @brief Prints the content of the CAT table 102 * 103 * @param parms struct dvb_v5_fe_parms pointer to the opened device 104 * @param table pointer to struct dvb_table_cat 105 */ 106 void dvb_table_cat_print (dvb_v5_fe_parms* parms, dvb_table_cat* table);